@import "./var.scss";
@import "./reset.scss";

/*flex布局*/
.flex {
  display: flex;
}

.flex-item {
  flex: 1;
}

.flex-center {
  align-items: center;
}

.flex-start {
  align-items: flex-start;
}

/*1像素边框*/
.bor-1px,
.bor-1px-t,
.bor-1px-b,
.bor-1px-tb,
.bor-1px-l,
.bor-1px-r {
  position: relative;
  min-height: 1px;

  &::before,
  &::after {
    content: '';
    position: absolute;
    z-index: 2;
    transform-style: preserve-3d;
  }
}

.bor-1px-t {
  &::before {
    left: 0;
    top: 0;
    right: 0;
    height: 0;
    border-top: 1px solid $borderColor;
    transform: scaleY(0.5);
  }
}

.bor-1px-b {
  &::after {
    left: 0;
    bottom: 0;
    right: 0;
    height: 0;
    border-top: 1px solid $borderColor;
    transform: scaleY(0.5);
  }
}

.bor-1px-r {
  &::before {
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid $borderColor;
    transform-origin: 0 0;
    transform: scaleX(0.5);
  }
}

.bor-1px-l {
  &::after {
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px solid $borderColor;
    transform-origin: 0 0;
    transform: scaleX(0.5);
  }
}

/*圆角*/
.radius0 {
  border-radius: 0 !important;
}

.radius50 {
  border-radius: 50%;
}

.radius10 {
  border-radius: vw(10);
}

.radius16 {
  border-radius: vw(16);
}

.radius20 {
  border-radius: vw(20);
}

// 文本
.text-muted {
  color: $mutedColor;
}

.text-gray {
  color: $grayColor;
}

.text-default {
  color: $defaultTextColor;
}

.text-blue {
  color: $blueColor;
}

.text-red {
  color: $redColor;
}

.text-green {
  color: $greenColor;
}

.text-yellow {
  color: $yellowColor;
}

.text-white {
  color: #fff;
}

.tc {
  text-align: center;
}

.tr {
  text-align: right;
}

.fw300 {
  font-weight: 300;
}

.fw400 {
  font-weight: 400;
}

.fw500 {
  font-weight: 500;
}

.fw600 {
  font-weight: 600;
}

.fw700 {
  font-weight: 700;
}

.line-through {
  text-decoration: line-through;
}

/*文本省略号 line1 就1行省略*/
.line1 {
  @include ellipsisLn(1);
}

.line2 {
  @include ellipsisLn(2);
  line-height: 1.4em;
}

.line3 {
  @include ellipsisLn(3);
  line-height: 1.4em;
}

/*分隔线*/
.divider {
  display: flex;
  text-align: center;
  align-items: center;
  font-size: vw(24);
  color: #999;
  margin: 0 auto;

  &::after, &::before {
    content: "";
    flex: 1;
    left: 0;
    bottom: 0;
    right: 0;
    height: 0;
    border-top: 1px solid $borderColor;
    transform: scaleY(0.5);
  }

  &.dashed {
    &::after, &::before {
      border-top: 1px dashed $borderColor;
    }
  }

  span {
    margin: 0 8px;
  }
}

/*绝对定位*/
.abs {
  position: absolute;
  z-index: 9;

  &.abslt {
    left: 0;
    top: 0;
  }

  &.absrt {
    right: 0;
    top: 0;
  }

  &.abslb {
    left: 0;
    bottom: 0;
  }

  &.absrb {
    right: 0;
    bottom: 0;
  }

  &.abscc {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  &.abscc {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  &.abslc {
    left: 0;
    top: 50%;
    transform: translate(0, -50%);
  }

  &.absrc {
    right: 0;
    top: 50%;
    transform: translate(0, -50%);
  }

  &.abstc {
    left: 50%;
    top: 0;
    transform: translate(-50%, 0);
  }

  &.absbc {
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 0);
  }
}

/*内外边距*/
/*mixin*/
$mpList: 5, 10, 15, 20, 30, 40;
@each $item in $mpList {
  .plr#{$item} {
    padding-left: vw($item);
    padding-right: vw($item);
  }
  .ptb#{$item} {
    padding-top: vw($item);
    padding-bottom: vw($item);
  }
  .pt#{$item} {
    padding-top: vw($item);
  }
  .pb#{$item} {
    padding-bottom: vw($item);
  }
  .pl#{$item} {
    padding-left: vw($item);
  }
  .mlr#{$item} {
    margin-left: vw($item);
    margin-right: vw($item);
  }
  .mtb#{$item} {
    margin-top: vw($item);
    margin-bottom: vw($item);
  }
  .mt#{$item} {
    margin-top: vw($item);
  }
  .mb#{$item} {
    margin-bottom: vw($item);
  }
  .ml#{$item} {
    margin-left: vw($item);
  }
  .mr#{$item} {
    margin-right: vw($item);
  }
}

$fontSize: 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 44, 46, 50;
@each $item in $fontSize {
  .fs#{$item} {
    font-size: vw($item);
  }
}

$whList: 30, 60, 70, 80, 90, 100, 120, 140, 150, 160, 180, 200, 220, 240;
@each $item in $whList {
  .wh#{$item} {
    width: vw($item);
    height: vw($item);
  }
}

/*骨架屏*/
.skeleton {
  position: relative;

  &::before {
    content: "\5360\4F4D\6587\672C";
    font-size: inherit;
    line-height: inherit;
    float: left;
  }

  &::after {
    content: "";
    color: transparent;
    font-size: inherit;
    line-height: inherit;
    @include pos100();
    animation-duration: 2s;
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    animation-name: placeHolderShimmer;
    animation-timing-function: linear;
    background: #f6f7f8;
    background: linear-gradient(to right, #eeeeee 8%, #dddddd 18%, #eeeeee 33%);
    background-size: 800px 104px;
  }
}

@keyframes placeHolderShimmer {
  0% {
    background-position: -468px 0
  }
  100% {
    background-position: 468px 0
  }
}

.bgfff {
  background-color: #fff;
}

[v-cloak] {
  display: none
}

.clear-fix:after {
  content: "";
  display: table;
  clear: both;
}